// JavaScript Document

/**
 * url跳转(直接跳转)
 */
function jumpurl(url) {
    window.location.href = url;
    return false;
}

/**
 * url跳转(间隔多少秒后跳转)
 */
function jumpurlTime(url, time) {
    setTimeout("window.location.href = '" + url + "'", time);
}

/**
 * 只显示遮罩层
 */
function showBoxBg() {
    var temp_float = new String;
    temp_float = "<div id=\"floatBoxBg\"></div>";
    $("body").append(temp_float);
    $("#floatBoxBg").css({display: "block", height: $(document).height()});
}
/**
 * 只关闭遮罩层
 */
function closeBoxBg() {
    $("#floatBoxBg").remove();
}

/**
 * 只显示弹出层
 */
function showBox(idorclass) {
    $(idorclass).css('z-index', 701);
    var h = $(window).scrollTop();
    var top = h + ( $(window).height() - parseInt($(idorclass).height()) ) / 2;
    var left = ( $(window).width() - parseInt($(idorclass).width()) ) / 2;
    $(idorclass).css({display: "block", top: top + "px", left: left + 'px'});
}

/**
 * 显示弹出层(遮罩层+弹出层)
 * @idorclass '#id' or '.class'
 */
function dialog(idorclass) {
    var temp_float = new String;
    temp_float = "<div id=\"floatBoxBg\"></div>";
    $("body").append(temp_float);
    $("#floatBoxBg").css({display: "block", height: $(document).height()});
    $(idorclass).css('z-index', 701);
    var h = $(window).scrollTop();
    var top = h + ( $(window).height() - parseInt($(idorclass).height()) ) / 2;
    var left = ( $(window).width() - parseInt($(idorclass).width()) ) / 2;
    $(idorclass).css({display: "block", top: top + "px", left: left + 'px'});
}

/**
 * 关闭弹出层（遮罩层+弹出层）
 * @idorclass '#id' or '.class'
 */
function closeDialog(idorclass) {
    $("#floatBoxBg").remove();
    $(idorclass).css('display', 'none');
}